package com.link2room.blaster;

import com.link2room.blaster.constant.BlasterMnsConstant;
import com.link2room.common.mns.Worker;
import com.link2room.common.mns.listener.MnsListener;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 加载mns消息服务轮询服务
 * Created by LN on 2016/8/25.
 */
@Component  //使用时，打开注释
public class BlasterMNSPollingStartupRunner implements CommandLineRunner {
    @Resource
    private Worker messageLogWorker;
    @Resource
    private Worker msgSendWroker;
    @Resource
    private Worker inmailSendWorker;
    @Resource
    private MnsListener defaultMnsListener;

    @Override
    public void run(String... strings) throws Exception {
        //微信消息回调处理
        defaultMnsListener.startPolling(BlasterMnsConstant.QUEUE_MSG_LOG,messageLogWorker);
//        订单成功消息发送
        defaultMnsListener.startPolling(BlasterMnsConstant.QUEUE_MSG_TO_SEND,msgSendWroker,4);
//        订单成功消息发送
        defaultMnsListener.startPolling(BlasterMnsConstant.QUEUE_MSG_TO_SEND,msgSendWroker,4);
//            站内信
        defaultMnsListener.startPolling(BlasterMnsConstant.QUEUE_IN_MAIL_SEND,inmailSendWorker,4);
    }
}